﻿namespace MemberShip.Imagine.Models.Helpers
{
    public static class PagingHelper
    {
        //index o day
        //Html.binh(3) return "<b>binh</b>";
        //paging theo type cua csdl
        public static string Paging(this System.Web.Mvc.HtmlHelper helper, string actionLink, int totalItem)
        {
            int n = totalItem / 10;
            n += 2;
            string link = "";
            for (int i = 1; i < n; i++)
            {
                string st = string.Format(@"<a href=""{0}?currentPage={1}"">[{2}]</a>", actionLink, i, i);

                link += st + "&nbsp;&nbsp;&nbsp;";
            }

            return link;

        }
        public static string PagingMember(this System.Web.Mvc.HtmlHelper helper, int indexItem,string actionName,string controllerName)
        {

            string ss = string.Format("/{0}/{1}?currentPage={2}", controllerName, actionName,indexItem);
            return ss;
        }
       
    }
}